#!/bin/bash
#
get_script_abs_path()
{
	_script_file=$BASH_SOURCE
	i=0
	while [[ `ls -l $_script_file|grep -e '->'` != "" ]]; do
		link__script_file=`ls $_script_file -l|awk -F '->' '{print $2}'`
		link__script_file=`echo $link__script_file`
		cg_link__script_file=`dirname $_script_file`/$link__script_file
		if [ ! -e $cg_link__script_file ]; then
			cg_link__script_file=$link__script_file
		fi
		_script_file=$cg_link__script_file
		echo "find-link-file: $cg_link__script_file"
		i=$((i+1))
		if [[ $i -gt 10 ]]; then
			echo "can not find the sublime start cmd, maybe much symbol link"
			exit 1
		fi
	done
	_script_real_dir=`dirname $_script_file`
	_script_real_name=`basename $_script_file`
	cd $_script_real_dir
	_script_abs_real_dir=`pwd`
	cd - &>/dev/null
	_script_abs_real_file=$_script_abs_real_dir/$_script_real_name
}
get_script_abs_path

cd $_script_real_dir
cd web
sudo -u nginx python `pwd`/app.py 2>err.log 1>web.log &

